import React, { Component } from 'react'

// 如下就是定义接收的父组件中的props
type Props = {
    username: string,
    editusernameFn(): void
}

type State = {}

export default class Son extends Component<Props, State> {
    state = {}

    render() {
        console.log(this.props);

        return (
            <div>
                <p>Son组件</p>
                <p><button onClick={() => {
                    this.props.editusernameFn()
                }}>修改username</button></p>
            </div>
        )
    }
}